package ahblue.cn.tanzi.ui.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import ahblue.cn.tanzi.util.ActivityUtils;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;

public class BaseActivity extends AppCompatActivity {
    CompositeDisposable mCompositeDisposable = new CompositeDisposable();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        ActivityUtils.getInstance().addActivity(this, null, 0);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onDestroy() {
        ActivityUtils.getInstance().removeActivity(this, 0);
        mCompositeDisposable.dispose();
        super.onDestroy();
    }

    public void addRxDisposable(Disposable d) {
        mCompositeDisposable.add(d);
    }
}
